﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SQuestionController.cs" company="hoandd">
//   hoandd
// </copyright>
// <summary>
//   Summary description for SQuestionController
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace DesktopModules.Surveys
{
    using System.Collections.Generic;
    using DotNetNuke.Common.Utilities;

    /// <summary>
    /// Summary description for SQuestionController
    /// </summary>
    public class SQuestionController
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="SQuestionController"/> class.
        /// </summary>
        public SQuestionController()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        #region Public Methods

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// adds an object to the database
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="obj">The SQuestionInfo object</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------

        public static int AddSQuestion(SQuestioninfo obj)
        {
            return ((int)(DataProvider.Instance().AddSQuestion(
                obj.OrgID,
                obj.QuestionType,
                obj.QuestionContent,
                obj.Hidden,
                obj.Public,
                obj.DateCreated,
                obj.LastModified,
                obj.CreatedByUserID,
                obj.ModifiedByUserID,
                obj.ModuleID)));
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// deletes an object from the database
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="">The SQuestionID of the SQuestion</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public static void DeleteSQuestion(int SQuestionID)
        {
            DataProvider.Instance().DeleteSQuestion(SQuestionID);
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// gets an object from the database
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="">TheSQuestionID of SQuestion</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public static SQuestioninfo GetSQuestion(int SQuestionID)
        {
            return CBO.FillObject<SQuestioninfo>(DataProvider.Instance().GetSQuestion(SQuestionID));
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// gets an object from the database
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public static List<SQuestioninfo> GetSQuestions()
        {
            return CBO.FillCollection<SQuestioninfo>(DataProvider.Instance().GetSQuestions());
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// saves an object to the database
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="obj">The SQuestionInfo object</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public static void UpdateSQuestion(SQuestioninfo obj)
        {
            DataProvider.Instance().UpdateSQuestion(
                obj.SQuestionID,
                obj.OrgID,
                obj.QuestionType,
                obj.QuestionContent,
                obj.Hidden,
                obj.Public,
                obj.DateCreated,
                obj.LastModified,
                obj.CreatedByUserID,
                obj.ModifiedByUserID, obj.ModuleID);
        }

        #endregion Public Methods
    }
}